package smu.KYBank;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {
    public DBHelper(Context context) {
        super(context, "bank.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) { 
        String table = 
            "CREATE TABLE member(id VARCHAR(20) PRIMARY KEY, pw INT, name VARCHAR(20), regi_num VARCHAR(14), phone VARCHAR(11), addr TEXT,account_num VARCHAR(4),balance int);" +
            "CREATE TABLE admin(id VARCHAR(20) , type VARCHAR(10), account_num VARCHAR(4));";
        
  // AUTOINCREMENT      
        db.execSQL(table);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {        
        db.execSQL("DROP TABLE IF EXISTS account");
        onCreate(db);
    }
}

